import React, { Component } from "react";
import Redirect from "umi/redirect";
import { connect } from "dva";

@connect(({ push, add }) => ({ push: push }))
class Index extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {
    let logoInfo = JSON.parse(localStorage.getItem("loginData")) || "";
    if (logoInfo.userInfo && logoInfo.userInfo.id) {
      this.props.dispatch({
        type: "push/getPushSiteList",
        payload: {
          id: logoInfo.userInfo.id
        }
      });
    }
  }

  render() {
    return <Redirect to={`/`} query={this.props.location.query} />;
  }
}

export default Index;
